package com.sx.manage.controller.base;

import java.io.IOException;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sx.manage.service.company.IMBaseCompanyService;
import com.sx.manage.service.consumer.MConsumerBankWebServiceImpl;
import com.sx.model.manage.mybatis.form.consumer.MCompanyForm;
import com.sx.model.manage.mybatis.form.consumer.MPersonalConsumerNetworkForm;
import com.sx.model.manage.mybatis.vo.bank.MDropDownVO;
import com.sx.model.manage.mybatis.vo.company.MCompanyVO;
import com.sx.model.manage.mybatis.vo.consumer.MPersonalConsumerVO;
import com.sx.model.manage.mybatis.vo.result.ResultDropDownListVO;
import com.sx.model.manage.mybatis.vo.result.ResultListVO;
import com.sx.model.manage.mybatis.vo.result.ResultObjectVO;
import com.sx.model.shopping.mybatis.form.goods.MGoodsInfoForm;
@Controller
@RequestMapping("/ajax")
public class MAjaxController extends MBaseController{
	
	private Logger log = LoggerFactory.getLogger(this.getClass());
	
	
	@Resource(name="consumerBankWebServiceImpl")
	private MConsumerBankWebServiceImpl consumerBankWebServiceImpl;
	
	@Resource(name = "mBaseCompanyServiceImpl")
	private IMBaseCompanyService mBaseCompanyServiceImpl;
	
	/**
	 * 
	 * @param form
	 * @return
	 */
	@RequestMapping("/query_user_vo")
	@ResponseBody
	public ResultListVO<MPersonalConsumerVO> ajax_bank_account_adjust(MPersonalConsumerNetworkForm form) {
		return consumerBankWebServiceImpl.queryConsumerBankForSelect(form);
	}
	/**
	 * 
	 * @param form
	 * @return
	 */
	@RequestMapping("/query_user_inside_account_vo")
	@ResponseBody
	public ResultListVO<MPersonalConsumerVO> query_user_inside_account_vo(MPersonalConsumerNetworkForm form) {
		return consumerBankWebServiceImpl.queryConsumerBankForSelect(form);
	}
	/** 查询公司信息列表**/
	@RequestMapping("/queryCompanyList")
	@ResponseBody
	public ResultListVO<MCompanyVO> getCompanyListForAjax(MCompanyForm form) throws  IOException {
		log.info("查询公司列表数据form={}",form);
		return mBaseCompanyServiceImpl.get_company_page(form);
	}
	/** 根据id查询公司信息**/
	@RequestMapping("/queryCompanyById/{id}")
	@ResponseBody
	public ResultObjectVO<MCompanyVO> query_company_by_id(@PathVariable Long id) {
		log.debug("根据id查询公司信息id={}", id);
		return mBaseCompanyServiceImpl.search_by_bank_Ids(new MCompanyForm(id));
	}
}
